﻿<!--#include file="../Include/Config.asp"-->
<link rel="stylesheet" href="../Css/Admin.css" type="text/css" />
<%
Survey_id=request.QueryString("Survey_id")
action=request.QueryString("Action")
select case action'分析动作，执行各种操作后再加载页面
   case "audi"
   call CheckNum(Survey_id)
   sql="select Survey_content from survey where Survey_id="&Survey_id
   rs.open sql,conn,1,1
   if rs("Survey_content")<>"" then
   sqlt="update survey set Survey_isAuditing=1 where Survey_id="&Survey_id
   conn.execute(sqlt)
   else
   call ShowAlert("没有题目的问卷不允许通过审核","")
   end if
   rs.close
   case "forbid"
   call CheckNum(Survey_id)
   sql="update survey set Survey_isAuditing=0 where Survey_id="&Survey_id
   conn.execute(sql)
end select
%>
<div id="SuveyAdmin">
<table width="100%" align="center" cellpadding="0" cellspacing="0" id="SurveyAdmin" class="table">
<%
dim  sql,order_by,way,page_size,rscount,item_count,page_num,page_now,i
order_by=request.QueryString("order_by")
way=request.QueryString("way")
order_by="Survey_creatDate"
way="desc"
page_size=10
set rscount=conn.execute("select count(*) as item_count from survey")
	item_count=cint(rscount("item_count"))
	rscount.close
    page_num=item_count\page_size 
sql="select * from survey order by "&order_by&" "&way&""
rs.CursorLocation = 3
rs.open sql,conn,1,3
if not rs.eof then
	rs.pagesize=page_size
	page_now=1
	if trim(request.QueryString("page"))<>"" then
	page_now=cint(trim(request.QueryString("page")))
	end if
	if page_now>rs.pagecount or page_now<0 then
	page_now=1
	end if
	rs.absolutepage=page_now
%>
<tr class="title">
<th>问卷名称</th>
<th>发起者</th>
<th>创建日期</th>
<th>结束日期</th>
<th>通过审核</th>
<th>操作</th>
</tr>
<%
  i=1
  while not rs.eof and i<page_size+1
%>
<tr>
<td><a href="QuestionAdd.asp?Survey_id=<%=rs("Survey_id")%>"><%=rs("Survey_name")%></a></td>
<td><%=rs("Survey_author")%></td>
<td><%=rs("Survey_creatDate")%></td>
<td><%=rs("Survey_dateOver")%></td>
<td><%SwitchBoolean(rs("Survey_isAuditing"))%></td>
<td>
<%if rs("Survey_isAuditing")=1 then%>
<a href="?Action=forbid&Survey_id=<%=rs("Survey_id")%>">禁用</a>
<%else%>
<a href="?Action=audi&Survey_id=<%=rs("Survey_id")%>">通过</a>
<%end if%>
</td>
</tr>
<%
   rs.movenext
   i=i+1
   wend
%>
<tr>
<td colspan="6" align="right">
<div id="bottom_pagebox" style="padding-right:20px;">
当前第<%=page_now%>页
  <%if page_now=1 then%>首页
  <%else%><a href="SurveyAudi.asp?page=1">首页</a>
  <%end if%>
  <%if page_now>1 and rs.pagecount>1 then%>
  <a href="SurveyAudi.asp?page=<%=page_now-1%>">上一页</a>
  <%else%>上一页
  <%end if%>				
  <%if page_now<rs.pagecount then%> 
  <a href="SurveyAudi.asp?page=<%=page_now+1%>">下一页</a>
  <%else%>下一页
  <%end if%>				
  <%if page_now<>rs.pagecount then%> 
  <a href="SurveyAudi.asp?page=<%=rs.pagecount%>">尾页</a>
  <%else%>尾页
  <%end if%>
  共<%=rs.pagecount%>页/<%=item_count%>篇
</div>
</td>
</tr>
<%else%>
<tr>
<td colspan="6">暂时没有问卷，请<a href="SurveyAdd.asp">添加</a></td>
</tr>
<%
end if
rs.close
%>
</table>
</div>
